﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using log4net;
using AutoFacUtils;
using CashFlow.Db.Entity;
using CashFlow.Web.Service;
using CashFlow.Db.Repository;
using CashFlow.Web.Common;

namespace CashFlow.Web.Controllers
{
    public class HomeController : Controller
    {
        private static readonly ILog _logger = LogManager.GetLogger(typeof(HomeController));
        private IUserService GetUserService() { return AutoFacHelper.Get<IUserService>(); }
        private IUserInfoRepository GetUserInfoRepository() { return AutoFacHelper.Get<IUserInfoRepository>(); }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Product1()
        {
            return View();
        }

        public ActionResult Logout()
        {
            Session.Clear();
            Session.Abandon();
            var cookie = Response.Cookies.Get(MyConfig.SessionStateSection.CookieName);
            if (cookie != null)
            {
                cookie.Expires = DateTime.Now.AddDays(-1);
            }

            return Redirect(MyConfig.AuthenticationSection.Forms.LoginUrl);
        }
    }
}